﻿USE [ncc-sop]
GO
/****** Object:  Table [dbo].[rolesDef]    Script Date: 03/30/2013 17:21:42 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[rolesDef](
	[roleID] [int] IDENTITY(1,1) NOT NULL,
	[roleName] [varchar](50) NULL,
 CONSTRAINT [PK_rolesDef] PRIMARY KEY CLUSTERED 
(
	[roleID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
SET IDENTITY_INSERT [dbo].[rolesDef] ON
INSERT [dbo].[rolesDef] ([roleID], [roleName]) VALUES (1, N'system admin')
INSERT [dbo].[rolesDef] ([roleID], [roleName]) VALUES (2, N'DCI Staff')
INSERT [dbo].[rolesDef] ([roleID], [roleName]) VALUES (3, N'DRO Staff')
INSERT [dbo].[rolesDef] ([roleID], [roleName]) VALUES (4, N'DMO Staff')
INSERT [dbo].[rolesDef] ([roleID], [roleName]) VALUES (5, N'Data Managers')
SET IDENTITY_INSERT [dbo].[rolesDef] OFF
/****** Object:  Table [dbo].[roleReportMapping]    Script Date: 03/30/2013 17:21:42 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[roleReportMapping](
	[sn] [int] IDENTITY(1,1) NOT NULL,
	[roleID] [int] NULL,
	[tableID] [int] NULL,
	[createdBy] [varchar](50) NULL,
	[createdOn] [datetime] NULL,
	[updatedBy] [varchar](50) NULL,
	[updatedOn] [datetime] NULL,
 CONSTRAINT [PK_roleReportMapping] PRIMARY KEY CLUSTERED 
(
	[sn] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
SET IDENTITY_INSERT [dbo].[roleReportMapping] ON
INSERT [dbo].[roleReportMapping] ([sn], [roleID], [tableID], [createdBy], [createdOn], [updatedBy], [updatedOn]) VALUES (1, 1, 10, N'admin', CAST(0x0000A13900000000 AS DateTime), NULL, NULL)
INSERT [dbo].[roleReportMapping] ([sn], [roleID], [tableID], [createdBy], [createdOn], [updatedBy], [updatedOn]) VALUES (2, 1, 9, N'admin', CAST(0x0000A13900000000 AS DateTime), NULL, NULL)
INSERT [dbo].[roleReportMapping] ([sn], [roleID], [tableID], [createdBy], [createdOn], [updatedBy], [updatedOn]) VALUES (3, 1, 8, N'admin', CAST(0x0000A13900000000 AS DateTime), NULL, NULL)
INSERT [dbo].[roleReportMapping] ([sn], [roleID], [tableID], [createdBy], [createdOn], [updatedBy], [updatedOn]) VALUES (4, 1, 15, N'admin', CAST(0x0000A13900000000 AS DateTime), NULL, NULL)
INSERT [dbo].[roleReportMapping] ([sn], [roleID], [tableID], [createdBy], [createdOn], [updatedBy], [updatedOn]) VALUES (5, 1, 16, N'admin', CAST(0x0000A13900000000 AS DateTime), NULL, NULL)
INSERT [dbo].[roleReportMapping] ([sn], [roleID], [tableID], [createdBy], [createdOn], [updatedBy], [updatedOn]) VALUES (6, 1, 19, N'admin', CAST(0x0000A13900000000 AS DateTime), NULL, NULL)
INSERT [dbo].[roleReportMapping] ([sn], [roleID], [tableID], [createdBy], [createdOn], [updatedBy], [updatedOn]) VALUES (7, 2, 17, N'admin', CAST(0x0000A13900000000 AS DateTime), NULL, NULL)
INSERT [dbo].[roleReportMapping] ([sn], [roleID], [tableID], [createdBy], [createdOn], [updatedBy], [updatedOn]) VALUES (8, 2, 9, N'admin', CAST(0x0000A13900000000 AS DateTime), NULL, NULL)
INSERT [dbo].[roleReportMapping] ([sn], [roleID], [tableID], [createdBy], [createdOn], [updatedBy], [updatedOn]) VALUES (9, 2, 2, N'admin', CAST(0x0000A13900000000 AS DateTime), NULL, NULL)
INSERT [dbo].[roleReportMapping] ([sn], [roleID], [tableID], [createdBy], [createdOn], [updatedBy], [updatedOn]) VALUES (10, 2, 5, N'admin', CAST(0x0000A13900000000 AS DateTime), NULL, NULL)
INSERT [dbo].[roleReportMapping] ([sn], [roleID], [tableID], [createdBy], [createdOn], [updatedBy], [updatedOn]) VALUES (11, 3, 5, N'admin', CAST(0x0000A13900000000 AS DateTime), NULL, NULL)
INSERT [dbo].[roleReportMapping] ([sn], [roleID], [tableID], [createdBy], [createdOn], [updatedBy], [updatedOn]) VALUES (12, 3, 6, N'admin', CAST(0x0000A13900000000 AS DateTime), NULL, NULL)
INSERT [dbo].[roleReportMapping] ([sn], [roleID], [tableID], [createdBy], [createdOn], [updatedBy], [updatedOn]) VALUES (13, 3, 10, N'admin', CAST(0x0000A13900000000 AS DateTime), NULL, NULL)
INSERT [dbo].[roleReportMapping] ([sn], [roleID], [tableID], [createdBy], [createdOn], [updatedBy], [updatedOn]) VALUES (14, 3, 9, N'admin', CAST(0x0000A13900000000 AS DateTime), NULL, NULL)
INSERT [dbo].[roleReportMapping] ([sn], [roleID], [tableID], [createdBy], [createdOn], [updatedBy], [updatedOn]) VALUES (20, 1, 26, N'admin', CAST(0x0000A18F00000000 AS DateTime), NULL, NULL)
INSERT [dbo].[roleReportMapping] ([sn], [roleID], [tableID], [createdBy], [createdOn], [updatedBy], [updatedOn]) VALUES (21, 3, 26, N'admin', CAST(0x0000A18F00000000 AS DateTime), NULL, NULL)
INSERT [dbo].[roleReportMapping] ([sn], [roleID], [tableID], [createdBy], [createdOn], [updatedBy], [updatedOn]) VALUES (22, 4, 26, N'admin', CAST(0x0000A18F00000000 AS DateTime), NULL, NULL)
INSERT [dbo].[roleReportMapping] ([sn], [roleID], [tableID], [createdBy], [createdOn], [updatedBy], [updatedOn]) VALUES (23, 2, 1, N'admin', CAST(0x0000A19000000000 AS DateTime), NULL, NULL)
INSERT [dbo].[roleReportMapping] ([sn], [roleID], [tableID], [createdBy], [createdOn], [updatedBy], [updatedOn]) VALUES (24, 4, 1, N'admin', CAST(0x0000A19000000000 AS DateTime), NULL, NULL)
SET IDENTITY_INSERT [dbo].[roleReportMapping] OFF
/****** Object:  Table [dbo].[MetadataTableAttributes]    Script Date: 03/30/2013 17:21:42 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[MetadataTableAttributes](
	[TableAttributeId] [int] IDENTITY(1,1) NOT NULL,
	[TableAttributeName] [varchar](50) NOT NULL,
	[TableAttributeDescription] [varchar](1000) NULL,
 CONSTRAINT [PK_MetadataTableAttributes] PRIMARY KEY CLUSTERED 
(
	[TableAttributeId] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
SET IDENTITY_INSERT [dbo].[MetadataTableAttributes] ON
INSERT [dbo].[MetadataTableAttributes] ([TableAttributeId], [TableAttributeName], [TableAttributeDescription]) VALUES (1, N'dataSource', N'')
INSERT [dbo].[MetadataTableAttributes] ([TableAttributeId], [TableAttributeName], [TableAttributeDescription]) VALUES (2, N'dataType', N'')
INSERT [dbo].[MetadataTableAttributes] ([TableAttributeId], [TableAttributeName], [TableAttributeDescription]) VALUES (3, N'data_filter1', N'')
SET IDENTITY_INSERT [dbo].[MetadataTableAttributes] OFF
/****** Object:  Table [dbo].[MetadataTables]    Script Date: 03/30/2013 17:21:42 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[MetadataTables](
	[TableId] [int] IDENTITY(1,1) NOT NULL,
	[TableName] [varchar](50) NOT NULL,
	[TableDescription] [varchar](1000) NULL,
	[TableLabel] [varchar](50) NULL,
	[createdBy] [nchar](100) NULL,
	[createdOn] [datetime] NULL,
	[updatedBy] [nchar](100) NULL,
	[updatedOn] [datetime] NULL,
	[status] [nchar](10) NULL,
	[fileName] [nchar](500) NULL,
 CONSTRAINT [PK_MetadataTables] PRIMARY KEY CLUSTERED 
(
	[TableId] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
SET IDENTITY_INSERT [dbo].[MetadataTables] ON
INSERT [dbo].[MetadataTables] ([TableId], [TableName], [TableDescription], [TableLabel], [createdBy], [createdOn], [updatedBy], [updatedOn], [status], [fileName]) VALUES (1, N'First test', N'this is the demo report', N'First test', N'admin                                                                                               ', CAST(0x0000A18D00000000 AS DateTime), N'admin                                                                                               ', CAST(0x0000A19000000000 AS DateTime), N'Active    ', N'                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ')
INSERT [dbo].[MetadataTables] ([TableId], [TableName], [TableDescription], [TableLabel], [createdBy], [createdOn], [updatedBy], [updatedOn], [status], [fileName]) VALUES (2, N'First test', N'this is the frist test', N'First test', N'admin                                                                                               ', CAST(0x0000A18D00000000 AS DateTime), NULL, NULL, N'Active    ', N'                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ')
INSERT [dbo].[MetadataTables] ([TableId], [TableName], [TableDescription], [TableLabel], [createdBy], [createdOn], [updatedBy], [updatedOn], [status], [fileName]) VALUES (3, N'Second test', N'this is another test', N'Second test', N'admin                                                                                               ', CAST(0x0000A18D00000000 AS DateTime), NULL, NULL, N'Active    ', N'                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ')
INSERT [dbo].[MetadataTables] ([TableId], [TableName], [TableDescription], [TableLabel], [createdBy], [createdOn], [updatedBy], [updatedOn], [status], [fileName]) VALUES (4, N'Second test', N'this is antoerh test', N'Second test', N'admin                                                                                               ', CAST(0x0000A18D00000000 AS DateTime), NULL, NULL, N'Active    ', N'staticReports/Combine.pdf                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           ')
INSERT [dbo].[MetadataTables] ([TableId], [TableName], [TableDescription], [TableLabel], [createdBy], [createdOn], [updatedBy], [updatedOn], [status], [fileName]) VALUES (5, N'Second test', N'tsetes', N'Second test', N'admin                                                                                               ', CAST(0x0000A18D00000000 AS DateTime), NULL, NULL, N'          ', N'staticReports/Combine.pdf                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           ')
INSERT [dbo].[MetadataTables] ([TableId], [TableName], [TableDescription], [TableLabel], [createdBy], [createdOn], [updatedBy], [updatedOn], [status], [fileName]) VALUES (6, N'Second test', N'tes', N'Second test', N'admin                                                                                               ', CAST(0x0000A18D00000000 AS DateTime), NULL, NULL, N'Active    ', N'staticReports/Combine.pdf                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           ')
INSERT [dbo].[MetadataTables] ([TableId], [TableName], [TableDescription], [TableLabel], [createdBy], [createdOn], [updatedBy], [updatedOn], [status], [fileName]) VALUES (7, N'Second test', N'estestest', N'Second test', N'admin                                                                                               ', CAST(0x0000A18D00000000 AS DateTime), NULL, NULL, N'Active    ', N'staticReports/Combine.pdf                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           ')
INSERT [dbo].[MetadataTables] ([TableId], [TableName], [TableDescription], [TableLabel], [createdBy], [createdOn], [updatedBy], [updatedOn], [status], [fileName]) VALUES (8, N'test', N'', N'test', N'admin                                                                                               ', CAST(0x0000A13900000000 AS DateTime), NULL, NULL, N'active    ', N'test                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                ')
INSERT [dbo].[MetadataTables] ([TableId], [TableName], [TableDescription], [TableLabel], [createdBy], [createdOn], [updatedBy], [updatedOn], [status], [fileName]) VALUES (9, N'test', N'', N'test', N'admin                                                                                               ', CAST(0x0000A13900000000 AS DateTime), NULL, NULL, N'active    ', N'test                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                ')
INSERT [dbo].[MetadataTables] ([TableId], [TableName], [TableDescription], [TableLabel], [createdBy], [createdOn], [updatedBy], [updatedOn], [status], [fileName]) VALUES (10, N'Second test', N'estestest', N'Second test', N'admin                                                                                               ', CAST(0x0000A18D00000000 AS DateTime), NULL, NULL, N'Active    ', N'staticReports/Combine.pdf                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           ')
INSERT [dbo].[MetadataTables] ([TableId], [TableName], [TableDescription], [TableLabel], [createdBy], [createdOn], [updatedBy], [updatedOn], [status], [fileName]) VALUES (11, N'test', N'', N'test', N'admin                                                                                               ', CAST(0x0000A13900000000 AS DateTime), NULL, NULL, N'active    ', N'test                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                ')
INSERT [dbo].[MetadataTables] ([TableId], [TableName], [TableDescription], [TableLabel], [createdBy], [createdOn], [updatedBy], [updatedOn], [status], [fileName]) VALUES (12, N'Second test', N'estestest', N'Second test', N'admin                                                                                               ', CAST(0x0000A18D00000000 AS DateTime), NULL, NULL, N'Active    ', N'staticReports/Combine.pdf                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           ')
INSERT [dbo].[MetadataTables] ([TableId], [TableName], [TableDescription], [TableLabel], [createdBy], [createdOn], [updatedBy], [updatedOn], [status], [fileName]) VALUES (13, N'Second test', N'estestest', N'Second test', N'admin                                                                                               ', CAST(0x0000A18D00000000 AS DateTime), NULL, NULL, N'Active    ', N'staticReports/Combine.pdf                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           ')
INSERT [dbo].[MetadataTables] ([TableId], [TableName], [TableDescription], [TableLabel], [createdBy], [createdOn], [updatedBy], [updatedOn], [status], [fileName]) VALUES (14, N'Second test', N'estestest', N'Second test', N'admin                                                                                               ', CAST(0x0000A18D00000000 AS DateTime), NULL, NULL, N'Active    ', N'staticReports/Combine.pdf                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           ')
INSERT [dbo].[MetadataTables] ([TableId], [TableName], [TableDescription], [TableLabel], [createdBy], [createdOn], [updatedBy], [updatedOn], [status], [fileName]) VALUES (15, N'Second test', N'estestest', N'Second test', N'admin                                                                                               ', CAST(0x0000A18D00000000 AS DateTime), NULL, NULL, N'Active    ', N'staticReports/Combine.pdf                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           ')
INSERT [dbo].[MetadataTables] ([TableId], [TableName], [TableDescription], [TableLabel], [createdBy], [createdOn], [updatedBy], [updatedOn], [status], [fileName]) VALUES (16, N'Second test', N'estestest', N'Second test', N'admin                                                                                               ', CAST(0x0000A18D00000000 AS DateTime), NULL, NULL, N'Active    ', N'staticReports/Combine.pdf                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           ')
INSERT [dbo].[MetadataTables] ([TableId], [TableName], [TableDescription], [TableLabel], [createdBy], [createdOn], [updatedBy], [updatedOn], [status], [fileName]) VALUES (17, N'Second test', N'estestest', N'Second test', N'admin                                                                                               ', CAST(0x0000A18D00000000 AS DateTime), NULL, NULL, N'Active    ', N'staticReports/Combine.pdf                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           ')
INSERT [dbo].[MetadataTables] ([TableId], [TableName], [TableDescription], [TableLabel], [createdBy], [createdOn], [updatedBy], [updatedOn], [status], [fileName]) VALUES (18, N'Second test', N'estestest', N'Second test', N'admin                                                                                               ', CAST(0x0000A18D00000000 AS DateTime), NULL, NULL, N'Active    ', N'staticReports/Combine.pdf                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           ')
INSERT [dbo].[MetadataTables] ([TableId], [TableName], [TableDescription], [TableLabel], [createdBy], [createdOn], [updatedBy], [updatedOn], [status], [fileName]) VALUES (19, N'Second test', N'estestest', N'Second test', N'admin                                                                                               ', CAST(0x0000A18D00000000 AS DateTime), NULL, NULL, N'Active    ', N'staticReports/Combine.pdf                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           ')
INSERT [dbo].[MetadataTables] ([TableId], [TableName], [TableDescription], [TableLabel], [createdBy], [createdOn], [updatedBy], [updatedOn], [status], [fileName]) VALUES (20, N'Second test', N'estestest', N'Second test', N'admin                                                                                               ', CAST(0x0000A18D00000000 AS DateTime), NULL, NULL, N'Active    ', N'staticReports/Combine.pdf                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           ')
INSERT [dbo].[MetadataTables] ([TableId], [TableName], [TableDescription], [TableLabel], [createdBy], [createdOn], [updatedBy], [updatedOn], [status], [fileName]) VALUES (21, N'Second test', N'estestest', N'Second test', N'admin                                                                                               ', CAST(0x0000A18D00000000 AS DateTime), NULL, NULL, N'Active    ', N'staticReports/Combine.pdf                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           ')
INSERT [dbo].[MetadataTables] ([TableId], [TableName], [TableDescription], [TableLabel], [createdBy], [createdOn], [updatedBy], [updatedOn], [status], [fileName]) VALUES (22, N'Second test', N'estestest', N'Second test', N'admin                                                                                               ', CAST(0x0000A18D00000000 AS DateTime), NULL, NULL, N'Active    ', N'staticReports/Combine.pdf                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           ')
INSERT [dbo].[MetadataTables] ([TableId], [TableName], [TableDescription], [TableLabel], [createdBy], [createdOn], [updatedBy], [updatedOn], [status], [fileName]) VALUES (23, N'Second test', N'estestest', N'Second test', N'admin                                                                                               ', CAST(0x0000A18D00000000 AS DateTime), NULL, NULL, N'Active    ', N'staticReports/Combine.pdf                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           ')
INSERT [dbo].[MetadataTables] ([TableId], [TableName], [TableDescription], [TableLabel], [createdBy], [createdOn], [updatedBy], [updatedOn], [status], [fileName]) VALUES (24, N'Second test', N'estestest', N'Second test', N'admin                                                                                               ', CAST(0x0000A18D00000000 AS DateTime), NULL, NULL, N'Active    ', N'staticReports/Combine.pdf                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           ')
INSERT [dbo].[MetadataTables] ([TableId], [TableName], [TableDescription], [TableLabel], [createdBy], [createdOn], [updatedBy], [updatedOn], [status], [fileName]) VALUES (25, N'DRO Monthly Reports', N'this is another test report', N'DRO Monthly Reports', N'admin                                                                                               ', CAST(0x0000A18F00000000 AS DateTime), NULL, NULL, N'Active    ', N'staticReports/E-Ticket 18032013.pdf                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 ')
INSERT [dbo].[MetadataTables] ([TableId], [TableName], [TableDescription], [TableLabel], [createdBy], [createdOn], [updatedBy], [updatedOn], [status], [fileName]) VALUES (26, N'DCI monthly report', N'this is another test ', N'DCI monthly report', N'admin                                                                                               ', CAST(0x0000A18F00000000 AS DateTime), N'admin                                                                                               ', CAST(0x0000A18F00000000 AS DateTime), N'Active    ', N'                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ')
INSERT [dbo].[MetadataTables] ([TableId], [TableName], [TableDescription], [TableLabel], [createdBy], [createdOn], [updatedBy], [updatedOn], [status], [fileName]) VALUES (27, N'DMO report1', N'dfsfd', N'DMO report1', N'admin                                                                                               ', CAST(0x0000A18F00000000 AS DateTime), NULL, NULL, N'          ', N'staticReports/preliminary_program.pdf                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ')
SET IDENTITY_INSERT [dbo].[MetadataTables] OFF
/****** Object:  Table [dbo].[MetadataTableAttributeValues]    Script Date: 03/30/2013 17:21:42 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[MetadataTableAttributeValues](
	[TableId] [int] NOT NULL,
	[TableAttributeId] [int] NOT NULL,
	[TableAttributeValueId] [int] IDENTITY(1,1) NOT NULL,
	[TableAttributeValue] [varchar](255) NOT NULL,
 CONSTRAINT [PK_MetadataTableAttributeValues] PRIMARY KEY CLUSTERED 
(
	[TableAttributeValueId] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
SET IDENTITY_INSERT [dbo].[MetadataTableAttributeValues] ON
INSERT [dbo].[MetadataTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (1, 1, 1, N'MOSAIQ')
INSERT [dbo].[MetadataTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (1, 1, 2, N'CAISIS')
INSERT [dbo].[MetadataTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (1, 1, 3, N'BTB')
INSERT [dbo].[MetadataTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (1, 1, 4, N'OAS')
INSERT [dbo].[MetadataTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (1, 2, 5, N'Clinical Data')
INSERT [dbo].[MetadataTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (1, 2, 6, N'Clinical Research')
INSERT [dbo].[MetadataTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (1, 2, 7, N'Operational')
INSERT [dbo].[MetadataTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (1, 2, 8, N'Quality Control')
INSERT [dbo].[MetadataTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (1, 3, 9, N'For Fun Only')
INSERT [dbo].[MetadataTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (1, 3, 10, N'For Work')
INSERT [dbo].[MetadataTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (2, 1, 11, N'MOSAIQ')
INSERT [dbo].[MetadataTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (2, 2, 14, N'Clinical Data')
INSERT [dbo].[MetadataTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (18, 1, 23, N'MOSAIQ')
INSERT [dbo].[MetadataTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (24, 1, 24, N'MOSAIQ')
INSERT [dbo].[MetadataTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (24, 2, 25, N'Clinical Research')
INSERT [dbo].[MetadataTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (25, 1, 26, N'MOSAIQ')
INSERT [dbo].[MetadataTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (25, 2, 27, N'Clinical Data')
INSERT [dbo].[MetadataTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (26, 1, 28, N'MOSAIQ')
INSERT [dbo].[MetadataTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (26, 2, 29, N'Clinical Research')
INSERT [dbo].[MetadataTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (27, 1, 30, N'MOSAIQ')
INSERT [dbo].[MetadataTableAttributeValues] ([TableId], [TableAttributeId], [TableAttributeValueId], [TableAttributeValue]) VALUES (27, 2, 31, N'Clinical Data')
SET IDENTITY_INSERT [dbo].[MetadataTableAttributeValues] OFF
/****** Object:  View [dbo].[metadataRoleAssignment]    Script Date: 03/30/2013 17:21:42 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[metadataRoleAssignment]
AS
SELECT     dbo.roleReportMapping.tableID, dbo.rolesDef.roleName, dbo.roleReportMapping.createdBy, dbo.roleReportMapping.createdOn, dbo.roleReportMapping.updatedBy, 
                      dbo.roleReportMapping.updatedOn
FROM         dbo.roleReportMapping INNER JOIN
                      dbo.rolesDef ON dbo.roleReportMapping.roleID = dbo.rolesDef.roleID
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPane1', @value=N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
Begin DesignProperties = 
   Begin PaneConfigurations = 
      Begin PaneConfiguration = 0
         NumPanes = 4
         Configuration = "(H (1[40] 4[20] 2[20] 3) )"
      End
      Begin PaneConfiguration = 1
         NumPanes = 3
         Configuration = "(H (1 [50] 4 [25] 3))"
      End
      Begin PaneConfiguration = 2
         NumPanes = 3
         Configuration = "(H (1 [50] 2 [25] 3))"
      End
      Begin PaneConfiguration = 3
         NumPanes = 3
         Configuration = "(H (4 [30] 2 [40] 3))"
      End
      Begin PaneConfiguration = 4
         NumPanes = 2
         Configuration = "(H (1 [56] 3))"
      End
      Begin PaneConfiguration = 5
         NumPanes = 2
         Configuration = "(H (2 [66] 3))"
      End
      Begin PaneConfiguration = 6
         NumPanes = 2
         Configuration = "(H (4 [50] 3))"
      End
      Begin PaneConfiguration = 7
         NumPanes = 1
         Configuration = "(V (3))"
      End
      Begin PaneConfiguration = 8
         NumPanes = 3
         Configuration = "(H (1[56] 4[18] 2) )"
      End
      Begin PaneConfiguration = 9
         NumPanes = 2
         Configuration = "(H (1 [75] 4))"
      End
      Begin PaneConfiguration = 10
         NumPanes = 2
         Configuration = "(H (1[66] 2) )"
      End
      Begin PaneConfiguration = 11
         NumPanes = 2
         Configuration = "(H (4 [60] 2))"
      End
      Begin PaneConfiguration = 12
         NumPanes = 1
         Configuration = "(H (1) )"
      End
      Begin PaneConfiguration = 13
         NumPanes = 1
         Configuration = "(V (4))"
      End
      Begin PaneConfiguration = 14
         NumPanes = 1
         Configuration = "(V (2))"
      End
      ActivePaneConfig = 0
   End
   Begin DiagramPane = 
      Begin Origin = 
         Top = 0
         Left = 0
      End
      Begin Tables = 
         Begin Table = "roleReportMapping"
            Begin Extent = 
               Top = 6
               Left = 38
               Bottom = 125
               Right = 181
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "rolesDef"
            Begin Extent = 
               Top = 6
               Left = 219
               Bottom = 95
               Right = 361
            End
            DisplayFlags = 280
            TopColumn = 0
         End
      End
   End
   Begin SQLPane = 
   End
   Begin DataPane = 
      Begin ParameterDefaults = ""
      End
   End
   Begin CriteriaPane = 
      Begin ColumnWidths = 11
         Column = 1440
         Alias = 900
         Table = 1170
         Output = 720
         Append = 1400
         NewValue = 1170
         SortType = 1350
         SortOrder = 1410
         GroupBy = 1350
         Filter = 1350
         Or = 1350
         Or = 1350
         Or = 1350
      End
   End
End
' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'metadataRoleAssignment'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPaneCount', @value=1 , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'metadataRoleAssignment'
GO
/****** Object:  View [dbo].[metaDisplayView]    Script Date: 03/30/2013 17:21:42 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[metaDisplayView]
AS
SELECT DISTINCT 
                      dbo.MetadataTables.TableId, dbo.MetadataTables.TableName, dbo.MetadataTables.TableDescription, dbo.MetadataTables.fileName, 
                      MAX(CASE WHEN TableAttributeName LIKE 'dataSource' THEN TableAttributeValue ELSE NULL END) AS dataSource, 
                      MAX(CASE WHEN TableAttributeName LIKE 'dataType' THEN TableAttributeValue ELSE NULL END) AS dataType, 
                      MAX(CASE WHEN TableAttributeName LIKE 'data_filter1' THEN TableAttributeValue ELSE NULL END) AS data_filter1, dbo.MetadataTables.status, 
                      dbo.MetadataTables.updatedOn
FROM         dbo.MetadataTables INNER JOIN
                      dbo.MetadataTableAttributeValues ON dbo.MetadataTableAttributeValues.TableId = dbo.MetadataTables.TableId INNER JOIN
                      dbo.MetadataTableAttributes ON dbo.MetadataTableAttributeValues.TableAttributeId = dbo.MetadataTableAttributes.TableAttributeId
WHERE     (dbo.MetadataTables.status LIKE 'Active%')
GROUP BY dbo.MetadataTables.TableId, dbo.MetadataTables.TableName, dbo.MetadataTables.TableDescription, dbo.MetadataTables.fileName, dbo.MetadataTables.status, 
                      dbo.MetadataTables.updatedOn
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPane1', @value=N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
Begin DesignProperties = 
   Begin PaneConfigurations = 
      Begin PaneConfiguration = 0
         NumPanes = 4
         Configuration = "(H (1[40] 4[20] 2[20] 3) )"
      End
      Begin PaneConfiguration = 1
         NumPanes = 3
         Configuration = "(H (1 [50] 4 [25] 3))"
      End
      Begin PaneConfiguration = 2
         NumPanes = 3
         Configuration = "(H (1 [50] 2 [25] 3))"
      End
      Begin PaneConfiguration = 3
         NumPanes = 3
         Configuration = "(H (4 [30] 2 [40] 3))"
      End
      Begin PaneConfiguration = 4
         NumPanes = 2
         Configuration = "(H (1 [56] 3))"
      End
      Begin PaneConfiguration = 5
         NumPanes = 2
         Configuration = "(H (2 [66] 3))"
      End
      Begin PaneConfiguration = 6
         NumPanes = 2
         Configuration = "(H (4 [50] 3))"
      End
      Begin PaneConfiguration = 7
         NumPanes = 1
         Configuration = "(V (3))"
      End
      Begin PaneConfiguration = 8
         NumPanes = 3
         Configuration = "(H (1[56] 4[18] 2) )"
      End
      Begin PaneConfiguration = 9
         NumPanes = 2
         Configuration = "(H (1 [75] 4))"
      End
      Begin PaneConfiguration = 10
         NumPanes = 2
         Configuration = "(H (1[66] 2) )"
      End
      Begin PaneConfiguration = 11
         NumPanes = 2
         Configuration = "(H (4 [60] 2))"
      End
      Begin PaneConfiguration = 12
         NumPanes = 1
         Configuration = "(H (1) )"
      End
      Begin PaneConfiguration = 13
         NumPanes = 1
         Configuration = "(V (4))"
      End
      Begin PaneConfiguration = 14
         NumPanes = 1
         Configuration = "(V (2))"
      End
      ActivePaneConfig = 0
   End
   Begin DiagramPane = 
      Begin Origin = 
         Top = 0
         Left = 0
      End
      Begin Tables = 
         Begin Table = "MetadataTables"
            Begin Extent = 
               Top = 6
               Left = 38
               Bottom = 125
               Right = 222
            End
            DisplayFlags = 280
            TopColumn = 6
         End
         Begin Table = "MetadataTableAttributeValues"
            Begin Extent = 
               Top = 6
               Left = 260
               Bottom = 125
               Right = 470
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "MetadataTableAttributes"
            Begin Extent = 
               Top = 126
               Left = 38
               Bottom = 230
               Right = 265
            End
            DisplayFlags = 280
            TopColumn = 0
         End
      End
   End
   Begin SQLPane = 
   End
   Begin DataPane = 
      Begin ParameterDefaults = ""
      End
      Begin ColumnWidths = 9
         Width = 284
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
         Width = 1500
      End
   End
   Begin CriteriaPane = 
      Begin ColumnWidths = 12
         Column = 1440
         Alias = 900
         Table = 1170
         Output = 720
         Append = 1400
         NewValue = 1170
         SortType = 1350
         SortOrder = 1410
         GroupBy = 1350
         Filter = 1350
         Or = 1350
         Or = 1350
         Or = 1350
      End
   End
End
' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'metaDisplayView'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_DiagramPaneCount', @value=1 , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'VIEW',@level1name=N'metaDisplayView'
GO
/****** Object:  ForeignKey [FK_MetadataTableAttributeValues_MetadataTableAttributes]    Script Date: 03/30/2013 17:21:42 ******/
ALTER TABLE [dbo].[MetadataTableAttributeValues]  WITH CHECK ADD  CONSTRAINT [FK_MetadataTableAttributeValues_MetadataTableAttributes] FOREIGN KEY([TableAttributeId])
REFERENCES [dbo].[MetadataTableAttributes] ([TableAttributeId])
ON UPDATE CASCADE
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[MetadataTableAttributeValues] CHECK CONSTRAINT [FK_MetadataTableAttributeValues_MetadataTableAttributes]
GO
/****** Object:  ForeignKey [FK_MetadataTableAttributeValues_MetadataTables]    Script Date: 03/30/2013 17:21:42 ******/
ALTER TABLE [dbo].[MetadataTableAttributeValues]  WITH CHECK ADD  CONSTRAINT [FK_MetadataTableAttributeValues_MetadataTables] FOREIGN KEY([TableId])
REFERENCES [dbo].[MetadataTables] ([TableId])
ON UPDATE CASCADE
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[MetadataTableAttributeValues] CHECK CONSTRAINT [FK_MetadataTableAttributeValues_MetadataTables]
GO
